﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_Admin_DSJCJ.BLL
{
    /// <summary>
    /// 配置明细表 逻辑类
    /// </summary>
    public class ConfigEntry
    {
        /// <summary>
        /// 配置明细表数据类
        /// </summary>
        private DAL.ConfigEntry configEntryDAL = new DAL.ConfigEntry();
        /// <summary>
        /// 构造函数
        /// </summary>
        public ConfigEntry()
        {
        }

        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-03</date>
        /// </summary>
        /// <param name="entityNo">公司编号</param>
        /// <param name="keyName">关键字</param>
        /// <param name="configClass">配置类别</param>
        /// <returns>列表</returns>
        public List<ElingOA6_Admin_DSJCJ.Model.ConfigEntry> GetModelList(string entityNo, string keyName, string configClass)
        {
            DataSet ds = configEntryDAL.GetList(entityNo, keyName, configClass);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="dt">DataTable对象</param>
        /// <returns>列表</returns>
        private List<ElingOA6_Admin_DSJCJ.Model.ConfigEntry> DataTableToList(DataTable dt)
        {
            List<ElingOA6_Admin_DSJCJ.Model.ConfigEntry> modelList = new List<ElingOA6_Admin_DSJCJ.Model.ConfigEntry>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_Admin_DSJCJ.Model.ConfigEntry model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = configEntryDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }


        /// <summary>
        /// 获得数据列表
        /// <creator>sunlj</creator>
        /// <date>2014-5-9</date>
        /// </summary>
        /// <param name="entityNo">公司编号</param>
        /// <param name="configClass">配置类别</param>
        /// <returns>列表</returns>
        public List<Model.ConfigEntry> GetModelListWithShowText(string entityNo, string configClass)
        {
            DataSet ds = configEntryDAL.GetListWithShowText(entityNo, configClass);
            return DataTableToList(ds.Tables[0]);
        }






    }
}
